<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
  <title>Document</title>
</head>
<style>
  .d1 {
    width: 700px;
    height: 400px;
    background-color: aquamarine;
  }
</style>

<body>
  <div class="d1"></div>
  <script>
    //every()：判断数组中每一项都是否满足条件，只有所有项都满足条件，才会返回true。
    var arr = [1, 2, 3, 4, 5];
    var arr2 = arr.every(function (x) {
      return x < 10;
    });
    console.log(arr2); //true
    var arr3 = arr.every(function (x) {
      return x < 3;
    });
    console.log(arr3); // false


    //some()：判断数组中是否存在满足条件的项，只要有一项满足条件，就会返回true。
    var arr = [1, 2, 3, 4, 5];
    var arr2 = arr.some(function (x) {
      return x < 3;
    });
    console.log(arr2); //true
    var arr3 = arr.some(function (x) {
      return x < 1;
    });
    console.log(arr3); // false
  </script>
</body>

</html>